from django.shortcuts import render, HttpResponse,  redirect
from django.views.generic.base import View
# Create your views here.
from django.db.models import F,Q
from pure_pagination import Paginator, EmptyPage, PageNotAnInteger#导入分页模块的方法
from organization.models import CityDict, CourseOrg

class org_listView(View):
	def get(self, request):
		#城市
		cheng_shi=CityDict.objects.all()
		#课程机构
		ji_gou=CourseOrg.objects.all()
		ji_gou_shu=ji_gou.count()
		#分页
		try:
			page=request.GET.get('page', 1)
		except PageNotAnInteger:
			page=1

		p=Paginator(ji_gou, 1, request=request)	

		people=p.page(page)

		return render(request, 'org_list.html',{
			'cheng_shi':cheng_shi,
			'people':people,
			'ji_gou_shu':ji_gou_shu,
			})
	def post(self, request):
		pass
